package com.easylinkin.linkappapi.intelligentrule.entity;

import com.baomidou.mybatisplus.annotation.FieldStrategy;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableLogic;
import com.baomidou.mybatisplus.annotation.TableName;
import com.baomidou.mybatisplus.extension.activerecord.Model;
import com.easylinkin.linkappapi.deviceattribute.entity.DeviceAttribute;

import java.io.Serializable;

import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.experimental.Accessors;

/**
 * <p>
 *
 * </p>
 *
 * @author Tongjie
 * @since 2020-05-16
 */
@Data
@EqualsAndHashCode(callSuper = false)
@Accessors(chain = true)
@TableName("linkapp_intelligent_rule_expression")
@ApiModel("智能规则表达式")
public class IntelligentRuleExpression extends Model<IntelligentRuleExpression> {

    private static final long serialVersionUID = 1L;

    @TableId("id")
    @ApiModelProperty(value = "主键ID", example = "")
    private String id;


    /**
     * 触发器id
     */
    @ApiModelProperty(value = "触发器id", example = "")
    private String ruleTriggerId;


    /**
     * 设备属性
     */
    @TableField(exist = false)
    @ApiModelProperty(value = "设备属性", example = "")
    private DeviceAttribute deviceAttribute;

    /**
     * 设备属性id
     */
    @TableField("device_attribute_id")
    @ApiModelProperty(value = "设备属性id", example = "")
    private String deviceAttributeId;

    /**
     * 设备属性名称
     */
    @TableField(exist = false)
    @ApiModelProperty(value = "设备属性名称", example = "")
    private String deviceAttributeName;

    /**
     * 新设备属性id
     */
    @TableField(exist = false)
    @ApiModelProperty(value = "新设备属性id", example = "")
    private String newDeviceAttributeId;

    /**
     * 规则条件id
     */
    @TableField("rule_condition_id")
    @ApiModelProperty(value = "规则条件id", example = "")
    private String ruleConditionId;


    /**
     * 设备属性 父级id
     */
    @TableField("device_attribute_parent_id")
    @ApiModelProperty(value = "设备属性 父级id", example = "")
    private String deviceAttributeParentId;

    /**
     * 新设备属性 父级id
     */
    @TableField(exist = false)
    @ApiModelProperty(value = "新设备属性 父级id", example = "")
    private String newDeviceAttributeParentId;


    /**
     * 运算符
     */
    @TableField("calculate_sign")
    @ApiModelProperty(value = "运算符", example = "")
    private String calculateSign;
    /**
     * 表达式
     */
    @TableField("expression")
    @ApiModelProperty(value = "表达式", example = "")
    private String expression;

    @TableField("value")
    @ApiModelProperty(value = "运算值", example = "")
    private String value;

    /**
     * 排序  从1开始
     */
    @TableField("sort_no")
    @ApiModelProperty(value = "排序", example = "1")
    private Integer sortNo;

    /**
     * 逻辑运算符（与、或、非）
     */
    @TableField(value = "logic_code", strategy = FieldStrategy.IGNORED)
    @ApiModelProperty(value = "逻辑运算符", example = "非")
    private String logicCode;

    /**
     * 是否删除字段 0:已删; 1:存在
     */
    @TableLogic(value = "1", delval = "0")
    @ApiModelProperty(value = "是否删除字段", example = "1")
    private Integer deleteState = 1;


    @Override
    protected Serializable pkVal() {
        return this.id;
    }

}
